extends layout

block content
  h1=title
  ul.errors
    if errors
      each error, i in errors
        li.alert-danger #{error.msg}

  form(method='post', action='/api/posts/add', enctype='multipart/form-data')
    .form-group
      label Title:
      input.form-control(name='title', type='text')
    .form-group
      label Category
      select.form-control(name='category')
        each category, i in categories
          option(value=category.id) #{category.title}
    .form-group
      input(type='hidden', id='body-input', name='content')
      trix-editor(input='body-input')
    .form-group
      label Thumbnail Image
      input.form-control(name='thumbimage', type='file')
    input.btn.btn-default(name='submit', value='Save', type='submit')

    script(src='https://unpkg.com/trix@2.0.8/dist/trix.umd.min.js')
    script
